package cn.itcast.health.quartz;

import cn.itcast.health.commons.utils.DateUtils;
import cn.itcast.health.mapper.OrdersettingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;

@Component("orderSettingCleanHistoryData")
@Transactional
public class OrderSettingCleanHistoryData {
        @Autowired
        private OrdersettingMapper ordersettingMapper;

        public void cleanHistoryData(){
            System.out.println("-----OrderSettingClean  is  running ----");
            //获取当前时间,转成:年-月-日格式
            Date today = DateUtils.getToday();
            String format = DateUtils.parseDate2String(today);
            //删除当天之前的预约设置信息
            ordersettingMapper.cleanHistoryData(format);
            System.out.println("-----OrderSettingClean  is  over ----");
        }
}
